Dear statalist:
I would like to compose nested loops to get regression results. To my knowledge, the function of 'foreach of local' and 'foreach in `local-name'' are the same. But when I run the dotfiles, it seems like 4 fewer variables in the `of' than in the `in' format.
To keep things simple, my example shows what it would look like as following code. The results :
The first 'of local jlist' last displayed m = 4, while the 'in `jlist'' lasted displayed m = 7
Thanks a lot for any kind help!
I would like to compose nested loops to get regression results. To my knowledge, the function of 'foreach of local' and 'foreach in `local-name'' are the same. But when I run the dotfiles, it seems like 4 fewer variables in the `of' than in the `in' format.
To keep things simple, my example shows what it would look like as following code. The results :
The first 'of local jlist' last displayed m = 4, while the 'in `jlist'' lasted displayed m = 7
Thanks a lot for any kind help!
Code:
global Mediator "lnexercise_c lnExpense_healthcare_c lnExpense_education_c lnExpense_bussCare_c lnwateruse_c lnfireuse_c lnelectricuse_c" local jlist $Mediator local m = 0 foreach j of local jlist { gettoken j jlist : jlist sum `j' local `++m' display `m' } foreach j in `jlist' { gettoken j jlist : jlist sum `j' local `++m' display `m' }
Comment